home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / workbench+shell / a-f / alertpatch / ptest.c < prev    next >
C/C++ Source or Header  |  1995-12-21  |  3KB  |  90 lines

  1. ;/* displayalert.c - Execute me to compile me with SAS C 5.10
  2. LC -b1 -cfistq -v -y -j73 displayalert.c
  3. Blink FROM LIB:c.o,displayalert.o TO displayalert LIBRARY LIB:LC.lib,LIB:Amiga.lib
  4. quit
  5. */
  6.  
  7. /*
  8. Copyright (c) 1992 Commodore-Amiga, Inc.
  9.  
  10. This example is provided in electronic form by Commodore-Amiga, Inc. for
  11. use with the "Amiga ROM Kernel Reference Manual: Libraries", 3rd Edition,
  12. published by Addison-Wesley (ISBN 0-201-56774-1).
  13.  
  14. The "Amiga ROM Kernel Reference Manual: Libraries" contains additional
  15. information on the correct usage of the techniques and operating system
  16. functions presented in these examples.  The source and executable code
  17. of these examples may only be distributed in free electronic form, via
  18. bulletin board or as part of a fully non-commercial and freely
  19. redistributable diskette.  Both the source and executable code (including
  20. comments) must be included, without modification, in any copy.  This
  21. example may not be published in printed form or distributed with any
  22. commercial product.  However, the programming techniques and support
  23. routines set forth in these examples may be used in the development
  24. of original executable software products for Commodore Amiga computers.
  25.  
  26. All other rights reserved.
  27.  
  28. This example is provided "as-is" and is subject to change; no
  29. warranties are made.  All use is at your own risk. No liability or
  30. responsibility is assumed.
  31. */
  32.  
  33.  
  34. /*
  35. ** displayalert.c -  This program implements a recoverable alert
  36. */
  37. #define INTUI_V36_NAMES_ONLY
  38.  
  39. #include <exec/types.h>
  40. #include <intuition/intuition.h>
  41.  
  42. #include <clib/exec_protos.h>
  43. #include <clib/intuition_protos.h>
  44.  
  45. #include <stdio.h>
  46.  
  47. #ifdef LATTICE
  48. int CXBRK(void)    { return(0); }  /* Disable Lattice CTRL/C handling */
  49. int chkabort(void) { return(0); }  /* really */
  50. #endif
  51.  
  52.  
  53. /* Each string requires its own positioning information, as explained
  54. ** in the manual.  Hex notation has been used to specify the positions of
  55. ** the text. Hex numbers start with a backslash, an "x" and the characters
  56. ** that make up the number.
  57. **
  58. ** Each line needs 2 bytes of X position, and 1 byte of Y position.
  59. **   In our 1st line: x = \x00\xF0 (2 bytes) and y = \x14 (1 byte)
  60. **   In our 2nd line: x = \x00\xA0 (2 bytes) and y = \x24 (1 byte)
  61. ** Each line is null terminated plus a continuation character (0=done).
  62. ** This example assumes that the complier will concatenate adjacent
  63. ** strings into a single string with no extra NULLs.  The compiler does
  64. ** add the terminating NULL at the end of the entire string...The entire
  65. ** alert must end in TWO NULLs, one for the end of the string, and one
  66. ** for the NULL continuation character.
  67. */
  68.  
  69. UBYTE *alertMsg =
  70.     "\x00\xF0\x14" "OH NO, NOT AGAIN!" "\x00\x01"
  71.     "\x00\x80\x24" "PRESS MOUSEBUTTON:   LEFT=TRUE   RIGHT=FALSE" "\x00";
  72.  
  73. struct Library *IntuitionBase;
  74.  
  75. VOID main(int argc, char **argv)
  76. {
  77. if (IntuitionBase = OpenLibrary("intuition.library",33))
  78.     {
  79.  
  80.     printf("---$%x---\n", alertMsg);
  81.  
  82.     if (DisplayAlert(RECOVERY_ALERT, alertMsg, 52))
  83.         printf("Alert returned TRUE\n");
  84.     else
  85.         printf("Alert returned FALSE\n");
  86.  
  87.     CloseLibrary(IntuitionBase);
  88.     }
  89. }
  90.